// 获取当前时间 yyyy-MM-dd 格式
function getCurrentDate() {
    let tempDate = new Date(); // 获取今天的日期
    let formatDate;
    let MonthDate;
    tempDate.setDate(tempDate.getDate() - 1); // 今天的前N天的日期，N自定义
    if (tempDate.getDate() < 10) {
        formatDate = "0" + tempDate.getDate();
    } else {
        formatDate = tempDate.getDate();
    }
    if ((tempDate.getMonth() + 1) < 10) {
        MonthDate = "0" + (tempDate.getMonth() + 1);
    } else {
        MonthDate = tempDate.getMonth() + 1;
    }
    let endDate = tempDate.getFullYear() + "-" + MonthDate + "-" + formatDate;
    return endDate;
    // return "2024-03-25";
}
// 获取当前时间 yyyy-MM-dd HH:mm:ss 格式
function getDateTime() {
    const now = new Date();
    const year = now.getFullYear();
    const month = ('0' + (now.getMonth() + 1)).slice(-2);
    const day = ('0' + now.getDate()).slice(-2);
    const hour = ('0' + now.getHours()).slice(-2);
    const minute = ('0' + now.getMinutes()).slice(-2);
    const second = ('0' + now.getSeconds()).slice(-2);
    const formattedTime = `${year}-${month}-${day} ${hour}:${minute}:${second}`;
    return formattedTime
}